package com.bbs.controller;


import com.bbs.dto.Result;
import com.bbs.service.FollowService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/follow")
public class FollowController {

    @Autowired
    FollowService followService;
    @PutMapping("/{id}/{isFollow}")
    @Operation(summary = "关注功能",description = "关注描述")
    public Result follow(@PathVariable("id") Long followUserId,@PathVariable("isFollow") Boolean isFollow){
     return followService.follow(followUserId,isFollow);
    }

    @GetMapping("/judge/{id}")
    @Operation(summary = "判断是否关注")
    @Parameter(name="id",description = "用户ID",required = true)
    public Result isFollow(@PathVariable("id")Long followUserId){

return followService.judgeFollow(followUserId);
    }

    @GetMapping("/commen/{id}")
    @Operation(summary = "求用户共同关注")
    public Result followCommons(@PathVariable Long id){
        return followService.followCommons(id);
    }
}
